package com.husd.framework.compile;

/**
 * @author shengdonghu@126.com
 * @date 2022/8/23 14:07
 */
import com.sun.source.tree.ClassTree;
import com.sun.source.tree.ImportTree;
import com.sun.source.tree.VariableTree;
import com.sun.source.util.TreeScanner;
public class SourceVisitor extends TreeScanner<String, String> {
    @Override
    public String visitImport(ImportTree importTree, String s) {
        System.out.println("Find Import");
        System.out.println(importTree.getQualifiedIdentifier());
        return super.visitImport(importTree, s);
    }

    @Override
    public String visitClass(ClassTree classTree, String s) {
        System.out.println("Find Class Definition");
        System.out.println(classTree.getModifiers());
        System.out.println(classTree.getSimpleName());
        return super.visitClass(classTree, s);
    }

    @Override
    public String visitVariable(VariableTree variableTree, String s) {
        System.out.println("Find Variable Definition");
        System.out.println(variableTree.getType());
        System.out.println(variableTree.getName());
        return super.visitVariable(variableTree, s);
    }
}